package com.itheima.Demo1Scanner;

import java.util.Scanner;

public class Demo07 {
    public static void main(String[] args) {
        //1.键盘录入一个字符串,用Scanner实现
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入:");
        String s = sc.next();
        //2.将字符串拆分为字符数组
        //"hello"  -->{'h','e','l','l','o'}
        char[] chars = s.toCharArray();//将字符串转换为对应的字符数组返回
        //3.遍历字符数组
        for(int i = 0; i < chars.length; i++){
            System.out.println(chars[i]);
        }
    }
}
